UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mh3dE2hdEZpmAKuwWG6wlTNrTnldP4s0wGGzUPfbnm0=' 
WHERE 
  key_id = 'd888baa93a09d9d06d3216af5d73abb45c806d61bb661270a54be4e0fe910be7' 
  AND (
    token = 'Mh3dE2hdEZpmAKuwWG6wlTNrTnldP4s0wGGzUPfbnm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026