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

Query time 0.00018