UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aMCI8/kTtlWcIhvphVp4SyupTjTiJ/ZAwNitiMKWfB0=' 
WHERE 
  key_id = 'ef87d24db03814b582b59b3b4f046e753c1fe9670fb5d2279ffacbc8f8c72393' 
  AND (
    token = 'aMCI8/kTtlWcIhvphVp4SyupTjTiJ/ZAwNitiMKWfB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024