UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iui7favbOWDRKphCbeRPv8+UQWFfOHf38GduK1IH5Ec=' 
WHERE 
  key_id = 'f2b314d04e6b4e4ebab6ea6d0ce12bfde222e1b0fc21a9f6297bd918d845efc5' 
  AND (
    token = 'iui7favbOWDRKphCbeRPv8+UQWFfOHf38GduK1IH5Ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029