UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tvTlnMc6rZzxSz1h1nMG8KvlZYHn/566Q1Q5rIR84us='
WHERE
key_id = '510739bf19fc017c6ba947ae9ae09353375f00f828ac78e6098792c40224ffbc'
AND (
token = 'tvTlnMc6rZzxSz1h1nMG8KvlZYHn/566Q1Q5rIR84us='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)