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

Query time 0.00028