UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zy0zvUQ2lzkSpqEQh7ih6omPsOgu3d3ikD5mb7CjlCM=' 
WHERE 
  key_id = '4792e373910ff5499bc984b6090b0e35d8a09d9b9625d316a853054cdc993942' 
  AND (
    token = 'Zy0zvUQ2lzkSpqEQh7ih6omPsOgu3d3ikD5mb7CjlCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050