UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/BQm5XH6xbebOQiXJ7hTouRq7egQ5Y+zhOvUvIesxyQ='
WHERE
key_id = 'ddaf246f696f3af81b98f74cdd4f3431732e98a291227a05ec4b352a1816f1ae'
AND (
token = '/BQm5XH6xbebOQiXJ7hTouRq7egQ5Y+zhOvUvIesxyQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)