UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X5cRNpbnBFflbI9tvin5TSPZDFz3Xc0t28qWkM+b2Nk=' 
WHERE 
  key_id = '82e96961d803d39aa122dfdae0de918e397cbe05a838f4b5469c5d9786ee8724' 
  AND (
    token = 'X5cRNpbnBFflbI9tvin5TSPZDFz3Xc0t28qWkM+b2Nk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018