UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RrOUl+7X8QmxT+RUcTwwxR/t+/pigw/cdQQZLAmbJNM='
WHERE
key_id = 'a792fe979a4fc53380636d5da12fde5c881884504b86723f12df6cfb5ec1231c'
AND (
token = 'RrOUl+7X8QmxT+RUcTwwxR/t+/pigw/cdQQZLAmbJNM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)