UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'szhHN1PJTyK6jrESLwP+wrDytBtyUard1ODhN9rY7O8=' 
WHERE 
  key_id = '7bdbb0e80748fafe554c417d14eb192f15fc75dacb471f0ef8bcc1e385815522' 
  AND (
    token = 'szhHN1PJTyK6jrESLwP+wrDytBtyUard1ODhN9rY7O8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049