UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9DtMdMLAVSVTFsGkOwMaV/tw090t7l58czLJE5VKNlo=' 
WHERE 
  key_id = '9a76112ed6662e1faf029931749dce767724819469a5688b439e1b7cc125e867' 
  AND (
    token = '9DtMdMLAVSVTFsGkOwMaV/tw090t7l58czLJE5VKNlo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022