UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o9P/ampnyK2pkuPLWbkl6v0Dbz+3UxrETPa/IfukO/k=' 
WHERE 
  key_id = '7a5fc2ef88d45c47bb7d3761c217330aead664228d458db02c08ae0e48cc4ef6' 
  AND (
    token = 'o9P/ampnyK2pkuPLWbkl6v0Dbz+3UxrETPa/IfukO/k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027