UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x9PA3wVImXspDa+WhsstuDka+RlQwfJhiComavJt5Co=' 
WHERE 
  key_id = '929d4cd2103db013c9ee8e8571fc9c4036cc31bfa0d3ecb30aa442a9cbf24768' 
  AND (
    token = 'x9PA3wVImXspDa+WhsstuDka+RlQwfJhiComavJt5Co=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034