UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JzdPjCruHMIJlF4rG8Kf1BiKu6nmrHhfOc7wbFpIYRU=' 
WHERE 
  key_id = '15e0ea887b8dca489c7f629b964452a4ca8034e55ba8aba04e173d0094658b2d' 
  AND (
    token = 'JzdPjCruHMIJlF4rG8Kf1BiKu6nmrHhfOc7wbFpIYRU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046