UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rtmiwg/mpuAyNHfNqXr9uxMX4mo/GBg9nVCfMKc7cM4='
WHERE
key_id = 'd17f6717bc5d93280fba3fdd0b3ab27466c68059f9323d984e089c67086641fc'
AND (
token = 'rtmiwg/mpuAyNHfNqXr9uxMX4mo/GBg9nVCfMKc7cM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)