UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KXNDUuH6rk0B/y6r2vfE319UWiIL+DA9NwB8ZSivWRA='
WHERE
key_id = '22a33fa881695b6df4ef33e57f986a18ea3bdf82546452cab764db4bc11f1156'
AND (
token = 'KXNDUuH6rk0B/y6r2vfE319UWiIL+DA9NwB8ZSivWRA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)