UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8kuIJDQk9iEvp4AETMMFdbVErWJtQeWOB3EnCMpDcqo='
WHERE
key_id = '047cfe4be0537adf07c3d1b386b36c018c1824772ad0e530c9ddb0cb577a4c04'
AND (
token = '8kuIJDQk9iEvp4AETMMFdbVErWJtQeWOB3EnCMpDcqo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)