UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aIA3HtlxTndhHwAEF660OwgnOdQu44ZuZIeK26+SG20='
WHERE
key_id = '85b7f216fee95751d9f89093327dfc3feccd501ac4607150376011af7ec981af'
AND (
token = 'aIA3HtlxTndhHwAEF660OwgnOdQu44ZuZIeK26+SG20='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)