UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IwLxhpFNMABBgn9WfU68GvtXi6Ipnw0SzC+IkvmbH4M=' 
WHERE 
  key_id = 'f24534faf0c2c9712a2702792b06eb62a45991d39e57822645dc958ec19a4f11' 
  AND (
    token = 'IwLxhpFNMABBgn9WfU68GvtXi6Ipnw0SzC+IkvmbH4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076