UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'smoQ19Q6ZHNYZVNQE2ZC4eANGRFCZ7WILcHkbZMgp6E=' 
WHERE 
  key_id = '8f0a844846b333e4556d99fc5b9c23414df5e20e3d14ae810d0cbb194153ffec' 
  AND (
    token = 'smoQ19Q6ZHNYZVNQE2ZC4eANGRFCZ7WILcHkbZMgp6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021