UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ViHlbqeLezjxmDQAEHga0J7fuPmHj0IpIAwDTBeVmVQ=' 
WHERE 
  key_id = '1047142f84eefe912a09b79250ef80b07f034f35d4bdd21303615fc452746de1' 
  AND (
    token = 'ViHlbqeLezjxmDQAEHga0J7fuPmHj0IpIAwDTBeVmVQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021