UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y9S6gyoENypxt2nJzNqB8fbQEJSuMpx8/84J+MnHIzI='
WHERE
key_id = '9867cbfa4d3f3bc4bff75b62edcdc0bae65596823595c5a152f089a3086bf824'
AND (
token = 'y9S6gyoENypxt2nJzNqB8fbQEJSuMpx8/84J+MnHIzI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)