UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C7dzgfNqBQsP093i/9oZzaMLvXs8FQzJ7ccf9x2SzE8=' 
WHERE 
  key_id = '8803eca7960d4068addc351a3f0f68c6993fd4cc6614a918f7db378029189397' 
  AND (
    token = 'C7dzgfNqBQsP093i/9oZzaMLvXs8FQzJ7ccf9x2SzE8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042