UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BgQEt9XE4kLyIHg1YzcO7iU96NT+e9VRg4esQrBPFro='
WHERE
key_id = 'c7cd4dfcd348a69ba65ca5b7dc21ed06800b5a6e8b7ecae039300d778a77de78'
AND (
token = 'BgQEt9XE4kLyIHg1YzcO7iU96NT+e9VRg4esQrBPFro='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)