UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ACp6tCwFmoZq5f1zZBfkY3Lpo14BtNfaX0oz2knQO2M=' 
WHERE 
  key_id = '57d498cf764fae3e94078a61010b95b5a580f69055216d8d2cbac708d4ef3c43' 
  AND (
    token = 'ACp6tCwFmoZq5f1zZBfkY3Lpo14BtNfaX0oz2knQO2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029