UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k9ZTgCqB2inVnNY4bTDvz4iekEFB37PNeYiEp93H4eA='
WHERE
key_id = '3f7e13a14dcd970297a75107f1dbeffef0250c633d5577e1785f1a8ea17eec2f'
AND (
token = 'k9ZTgCqB2inVnNY4bTDvz4iekEFB37PNeYiEp93H4eA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)