UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g9//jq97zIGvE/5pB7rK1e/+Op/TnNMNls+7EKkLpT4=' 
WHERE 
  key_id = '35c214f524cad5df621a6b43593d800dff01572d59cedee2e679dfebcff77500' 
  AND (
    token = 'g9//jq97zIGvE/5pB7rK1e/+Op/TnNMNls+7EKkLpT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044