UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C6amF5SJOQy4W/S0K4B8mleT15knglGDEAetg8J4lZc='
WHERE
key_id = '88e2c2319f32443a4c404bc5d9b11ad7c9307bed02c4b1fac4307a8eead2a167'
AND (
token = 'C6amF5SJOQy4W/S0K4B8mleT15knglGDEAetg8J4lZc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)