UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jnr0sCOtzzTxxI+TyUN5tjguRCyo99jHvC8r7vvg21E='
WHERE
key_id = '8252875a9246001bbd99aa8cb6d8e1526050661bdb0132019568554ff6c29cd4'
AND (
token = 'jnr0sCOtzzTxxI+TyUN5tjguRCyo99jHvC8r7vvg21E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)