UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SfuIeVtVAppOb0LYTDZ9CHl6UWUt6OyKADojjED06Vc='
WHERE
key_id = '34bcb70bedfcd4071907dd4ec439dc4875270c347c9df25f6c79afb36e6be001'
AND (
token = 'SfuIeVtVAppOb0LYTDZ9CHl6UWUt6OyKADojjED06Vc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)