UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SiT9MqNzXUEvGbaUsr7UmP8FNc6IDjq8LVPNcZ9xH1A=' 
WHERE 
  key_id = '7721a8bb44db4f84b8a7dc2d1dcd72283f28bf1aff5144b1d83f910f517f0970' 
  AND (
    token = 'SiT9MqNzXUEvGbaUsr7UmP8FNc6IDjq8LVPNcZ9xH1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026