UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zxaHLDSIM2PFNjKRJtHbJ69D1RTqPH3S85Bj0DZ1ArU='
WHERE
key_id = 'aafd4b0ebe77328f702897ba89aa4373495d9841b440b890039421871fb38d36'
AND (
token = 'zxaHLDSIM2PFNjKRJtHbJ69D1RTqPH3S85Bj0DZ1ArU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)