UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A7jQfhhQ1lVrnDdRMbmcqjM38QQNa+BL1ITffzXx5Wk='
WHERE
key_id = 'b3d7e7bd756bc0effe06d5d2ddc98593c8447446f486559e65b26816c86f921d'
AND (
token = 'A7jQfhhQ1lVrnDdRMbmcqjM38QQNa+BL1ITffzXx5Wk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)