UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'STgiCo0rvjNUr3K+Hv8+ljkZ3QgyoxinNr3vOECjWD0=' 
WHERE 
  key_id = 'a377c0d2d3a16e40b39007505b13784f1515a112c41a3fc5ceaac1d1ab329f12' 
  AND (
    token = 'STgiCo0rvjNUr3K+Hv8+ljkZ3QgyoxinNr3vOECjWD0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031