UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W7NtyzbYdayUW896+6Wag0iMIsBDzZjWsOyNLFX/g0E='
WHERE
key_id = '0a3845e37bcb99273f5c418493878e8f10d1584abdeced3a7c4a364df6e0fc27'
AND (
token = 'W7NtyzbYdayUW896+6Wag0iMIsBDzZjWsOyNLFX/g0E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)