UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JFSaQYxr7YeMNPYJA7AX2fXfKooSHUYtjIj6qOt+JBY=' 
WHERE 
  key_id = 'f5761c45661027c4962696d41e7afc11a95f92de3fda1dd2a78c5f74d466b140' 
  AND (
    token = 'JFSaQYxr7YeMNPYJA7AX2fXfKooSHUYtjIj6qOt+JBY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036