UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K6lVKTlATCtgSIf6V1Xmh+Q6JU0VEPnPoHJG4z4KcE0='
WHERE
key_id = 'bf41522c9eb2dc79d90768e3c5f4f5844807d8c2d48f0447881c9c55eeee9d5b'
AND (
token = 'K6lVKTlATCtgSIf6V1Xmh+Q6JU0VEPnPoHJG4z4KcE0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)