UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yDtO5mmQTyGt34fPwjA+u6DsWGZk8JCxe3IRuNna6U4='
WHERE
key_id = 'd0a49f9901695d44f471c4bc49014e83340daaea0bb2504cf11b5b69013caf43'
AND (
token = 'yDtO5mmQTyGt34fPwjA+u6DsWGZk8JCxe3IRuNna6U4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)