UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JCCsd65wRfCP3dUK6CdceEL3T/O5sg7wmzm/bNEFZts=' 
WHERE 
  key_id = '2a987152a9499de85c94978d507d6a6dd5dac99b6832c87b82da3cc03f97247e' 
  AND (
    token = 'JCCsd65wRfCP3dUK6CdceEL3T/O5sg7wmzm/bNEFZts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069