UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'finDvvCfE1KeRl4+QQkTQ2XZiD3Bem/dtqklSJcYeng=' 
WHERE 
  key_id = '2e05cd5c0c2b40101d44221aa0d35f0d11df4d4911c8cbd2f4d4d805c86d0375' 
  AND (
    token = 'finDvvCfE1KeRl4+QQkTQ2XZiD3Bem/dtqklSJcYeng=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028