UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kt2cu8OMCMjvVmWmukMFpiPGote1iMF7+hv/AFU0QG0=' 
WHERE 
  key_id = '1d77b45b9c4ed905b8ae2487538a544bf03490328bcc19944d81cb83643aecee' 
  AND (
    token = 'Kt2cu8OMCMjvVmWmukMFpiPGote1iMF7+hv/AFU0QG0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049