UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NIBeFBoDUllzYSTwT9LPGzUVWfNd7Cd+Po55dseTG9I='
WHERE
key_id = '171fda1d90f7bdfa8b8b3dac3866d91dfad72947e172f9af107d801892e64085'
AND (
token = 'NIBeFBoDUllzYSTwT9LPGzUVWfNd7Cd+Po55dseTG9I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)