UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4nuWqCg4XDcTrKsSEmD9Ym+Ng+G8yHDohgyyg6B48Fw='
WHERE
key_id = 'c613c27918aacd9feafd98112c9b9b9406851450cb136e857b8e3d6c9973b967'
AND (
token = '4nuWqCg4XDcTrKsSEmD9Ym+Ng+G8yHDohgyyg6B48Fw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)