UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sn+jUOWQ9KUtz6clnNSN06wP0ZDxTJbubeJqzn2ovso=' 
WHERE 
  key_id = 'f682406fb7885148d591083d87da101e7d66918904c0491bdab207599c787d55' 
  AND (
    token = 'sn+jUOWQ9KUtz6clnNSN06wP0ZDxTJbubeJqzn2ovso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041