UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LfxzMuGqoGWntm3c8Sk9V8G0bCxNIFi+aNsohvYZ6BQ=' 
WHERE 
  key_id = 'a8b624b569c585e5518c486744e8f0569fe31891d772a7d17b588a43a9e3abad' 
  AND (
    token = 'LfxzMuGqoGWntm3c8Sk9V8G0bCxNIFi+aNsohvYZ6BQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077