UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SS6Biqiug+WROy14i1XD1WPNyYEO0QWkYzPZbwSAtHQ=' 
WHERE 
  key_id = '9a9ab8523925581268b7592d75b9cdbcaf345243ed4217102545a437ced64294' 
  AND (
    token = 'SS6Biqiug+WROy14i1XD1WPNyYEO0QWkYzPZbwSAtHQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029