UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TQIauFNqd0yBQeBua78zA8phbJdvnmNOgzN+0XuRh4Y=' 
WHERE 
  key_id = '7b81add778b704c92e73227e7f0bc5e667b512b984dc9da8251224efb185a470' 
  AND (
    token = 'TQIauFNqd0yBQeBua78zA8phbJdvnmNOgzN+0XuRh4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030