UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QOz93vPhb1PSDkHS/E4MPtc0UP521JyD9LWex7h5Jw8='
WHERE
key_id = 'b49dbc4fb97ce3ca9b856f9e79fdfcda73b26f92577a3e2cd9b44b516f0d9191'
AND (
token = 'QOz93vPhb1PSDkHS/E4MPtc0UP521JyD9LWex7h5Jw8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)