UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JuhUr5toldFHPU+CJugEVbuIN0cH/3uXkMmuZzQwfq8='
WHERE
key_id = 'dc36833e7b8294fa087a767e189b979de565c07411ed5a8a0fa2f507a4d499f2'
AND (
token = 'JuhUr5toldFHPU+CJugEVbuIN0cH/3uXkMmuZzQwfq8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)