UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5HbbmXCQK0u016wgU/xQ5Ej6rFFqChO129HLN+FC49o=' 
WHERE 
  key_id = '32f71050fc71fa87ecf5336f6d65ddee07f29cd17e5e60784deeb0cc3170e560' 
  AND (
    token = '5HbbmXCQK0u016wgU/xQ5Ej6rFFqChO129HLN+FC49o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032