UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2UO4u3qSaSeHnWpreYSfOPHl6WXa5IgYxE/SweW0ttw=' 
WHERE 
  key_id = '3f35306c242cc074bfc7b7a90deb12d50cc2dc92f23b4590f1d521765992e863' 
  AND (
    token = '2UO4u3qSaSeHnWpreYSfOPHl6WXa5IgYxE/SweW0ttw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058