UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '09NkOOec0UtAjJoPF4bgyXmJuO89hKTgVr4+jxLG3Cs='
WHERE
key_id = '71db66e31b6db2dc3e49213bba053ee9ea527dc99deb590a87c89b9fcd667cd8'
AND (
token = '09NkOOec0UtAjJoPF4bgyXmJuO89hKTgVr4+jxLG3Cs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)