UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3LjU0vPjMwzGkuW0AShpgKqHbKNKQ+4dvOT0pNkTR88='
WHERE
key_id = 'ec71c450dabe350d99e067d998c43108c0d474d50904d8a00782d2cab76bbd72'
AND (
token = '3LjU0vPjMwzGkuW0AShpgKqHbKNKQ+4dvOT0pNkTR88='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)