UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VobbdSHY3UDDLHpeNoE5G14/4qbfluDV0NiXPMMc4rA=' 
WHERE 
  key_id = '1fc180c3819156cc908b45176f335645f2e9638f07589686a2240c6ba33b6943' 
  AND (
    token = 'VobbdSHY3UDDLHpeNoE5G14/4qbfluDV0NiXPMMc4rA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037