UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vVLgLk2MANRP5f3s9rHHK9L5KWt6PD2DSp7jNNrdfLY=' 
WHERE 
  key_id = '9bf2ed652571ff0b322d067af4e52764becbc70172dcaa48b95ffad836de1485' 
  AND (
    token = 'vVLgLk2MANRP5f3s9rHHK9L5KWt6PD2DSp7jNNrdfLY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045