UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fnvv68eTz2rkjWipue0KCwVSguJRInj3GNxQJaGa1+E=' 
WHERE 
  key_id = '5ab5a49fa72b10545e5b24af87af1d946da2c2f5a7a400165c9d7df665daf1d4' 
  AND (
    token = 'Fnvv68eTz2rkjWipue0KCwVSguJRInj3GNxQJaGa1+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031