UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sf5XTpX9O1wJCdpofKMWegy6AUdjwaXp9yfh+L9GLbs='
WHERE
key_id = '4003a160bca9965d231ea2da8598126a729626ba8cd8b4a8a86f10a15b1e9c81'
AND (
token = 'sf5XTpX9O1wJCdpofKMWegy6AUdjwaXp9yfh+L9GLbs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)