UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vj86Q5DDgHXc9AlNTXM3kCzPi+gkC8SofJO7+Sik3Uw=' 
WHERE 
  key_id = 'f9a190dec0116327b2a00f7ccdb207dae5988b9501f131aee933ab9c32b13f80' 
  AND (
    token = 'Vj86Q5DDgHXc9AlNTXM3kCzPi+gkC8SofJO7+Sik3Uw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032