UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yMXGVhLn6dNWH5Z+qdfGBYYBazmAhmF7/qd7EwOyp9I=' 
WHERE 
  key_id = '038d752fb8b3757d2e7f8416c2b90b0ddcbc6e12ef6577f05588ae971419d949' 
  AND (
    token = 'yMXGVhLn6dNWH5Z+qdfGBYYBazmAhmF7/qd7EwOyp9I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00088