UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f8idEmKaaNX99srow4Fsa6hzStbL+4CTkH6dIlNBwkg=' 
WHERE 
  key_id = 'fbdebd49b03b546d087b1712d43b5bc6be99d9e5908fbcac8cbba2046b83d58e' 
  AND (
    token = 'f8idEmKaaNX99srow4Fsa6hzStbL+4CTkH6dIlNBwkg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031