UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FRaLUxkptWAgz44PLEL1fO6juQWoGi5GaT7KyflGqdE=' 
WHERE 
  key_id = '2e20ae6923c31721acc7f0a761fcbb8502615a1ec99397ab303f869efc06af59' 
  AND (
    token = 'FRaLUxkptWAgz44PLEL1fO6juQWoGi5GaT7KyflGqdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048