UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cY9mt+Bz8F3n9mnVeOYWWUr2wZyaaT5Px62RkxlmWn0='
WHERE
key_id = '2dd165ebd233e6ced8cbfdd82c54fdc4980e2e7eedbdaebdd8591a05477359d3'
AND (
token = 'cY9mt+Bz8F3n9mnVeOYWWUr2wZyaaT5Px62RkxlmWn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)