UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N1IzbHq66GuDERK01b7jZdoKZ6xTPvfvNinK3LF5ydU=' 
WHERE 
  key_id = '1a4f8307ea85fc5e4996b8705dcf8d820643e86fa52142bfa466a8aa0e383acb' 
  AND (
    token = 'N1IzbHq66GuDERK01b7jZdoKZ6xTPvfvNinK3LF5ydU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026